package com.star.platforms.controller.stock;


import com.star.platforms.common.ResultBean;
import com.star.platforms.service.impl.StockNewsColumnService;
import com.star.platforms.vo.BannerVo;
import com.star.platforms.vo.CommonPageListVo;
import com.star.platforms.vo.StockArticleVo;
import com.star.platforms.vo.StockNewsColumnVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author sam
 */
@RestController
@RequestMapping("/stock")
public class StockNewsController {
    @Autowired
    StockNewsColumnService stockNewsColumnService;

    /**
     * 获取Banner
     */
    @RequestMapping(value = "/getBannerList", method = RequestMethod.GET)
    public ResultBean<List<BannerVo>> getBannerList() {
        List<BannerVo> data = new ArrayList<>();
        data.clear();
        data.add(new BannerVo(1, "https://www.godboy.cn/download/other/b_1.png", "https://www.528btc.com/e/action/ShowInfo.php?classid=116&id=78656"));
        data.add(new BannerVo(1, "https://www.godboy.cn/download/other/b_2.png", "https://www.528btc.com/e/action/ShowInfo.php?classid=116&id=78656"));
        data.add(new BannerVo(1, "https://www.godboy.cn/download/other/b_4.png", "https://www.528btc.com/e/action/ShowInfo.php?classid=116&id=78656"));
        data.add(new BannerVo(1, "https://www.godboy.cn/download/other/b_5.png", "https://www.528btc.com/e/action/ShowInfo.php?classid=116&id=78656"));
        return new ResultBean<>(200,"成功",data);
    }

    /**
     * 获取标题栏列表
     */
    @RequestMapping(value = "/newsColumnList", method = RequestMethod.GET)
    public ResultBean<List<StockNewsColumnVo>> newsColumnList() {

        return stockNewsColumnService.getNewsColumnList();
    }

    /**
     * 获取新闻列表（分页）
     */
    @RequestMapping(value = "/getArticleList", method = RequestMethod.GET)
    public ResultBean<CommonPageListVo<StockArticleVo>> getArticleList(int pageNum) {
        return stockNewsColumnService.getArticleList(pageNum);
    }


}
